//
//  AppDelegate.m
//  NiuWaJiaoYu
//
//  Created by MinLison on 2017/8/18.
//  Copyright © 2017年 niuwaketang. All rights reserved.
//   牛蛙
#import "AppDelegate.h"
#import <BeeHive/BeeHive.h>
#import <BeeHive/BHTimeProfiler.h>
#import "MainMoudle.h"


@interface AppDelegate ()
@end

@implementation AppDelegate
@dynamic window;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//        BOOL hasLoadedData = [[NSUserDefaults standardUserDefaults] boolForKey:@"kHasLoadedData"];
//        if (!hasLoadedData) {
//                NSLog(@"2222");
//        }else{
//                NSLog(@"1111");
//        }
        [BHContext shareInstance].application = application;
        [BHContext shareInstance].launchOptions = launchOptions;
        [BHContext shareInstance].moduleConfigName = @"NiuWaJaoYu.bundle/BeeHive";
        [BHContext shareInstance].serviceConfigName = @"NiuWaJaoYu.bundle/BHService";

#if (DEBUG)
        [BHContext shareInstance].env = BHEnvironmentDev;
#elif defined(ADHoc)
        [BHContext shareInstance].env = BHEnvironmentTest;
#elif defined(ADHocOnline)
        [BHContext shareInstance].env = BHEnvironmentStage;
#else
        [BHContext shareInstance].env = BHEnvironmentProd;
#endif
        
        [BeeHive shareInstance].enableException = YES;
        [[BeeHive shareInstance] setContext:[BHContext shareInstance]];
        
        id <MainServiceProtocol> mainService = [[BeeHive shareInstance] createService:@protocol(MainServiceProtocol)];
       
        UIViewController *vc = [mainService getController];
        
        self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
        self.window.backgroundColor = QMUICMI.backgroundColor;
        self.window.rootViewController = vc;
        [self.window makeKeyAndVisible];
        
        [super application:application didFinishLaunchingWithOptions:launchOptions];
        
        return YES;
}

@end


int main(int argc, char * argv[]) {
        @autoreleasepool {
                return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
        }
}
